package com.dgut.shopManage.entity;

import java.util.ArrayList;
import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.OneToOne;
import javax.persistence.Table;

import com.dgut.common.util.Rent;
import com.dgut.common.util.Stype;

@Entity
@Table(name="t_shop")
public class Shop {
	private Long id;
	private String shopNo;   //店铺编号
 	private Stype stype;      //店铺类型
	private Rent rent;      //是否被租用
	private String address;
	
	private Merchant merchant;
	private List<Apply> applys = new ArrayList<Apply>();
	
	@OneToMany(cascade=CascadeType.ALL,mappedBy="shop",fetch=FetchType.LAZY)
	public List<Apply> getApplys() {
		return applys;
	}
	@OneToOne(cascade=CascadeType.ALL)
	public Merchant getMerchant() {
		return merchant;
	}
	@Id
	@GeneratedValue(strategy=GenerationType.IDENTITY)
	public Long getId() {
		return id;
	}
	public Rent getRent() {
		return rent;
	}
	public String getShopNo() {
		return shopNo;
	}
	public Stype getStype() {
		return stype;
	}

	public String getAddress() {
		return address;
	}

	public void setRent(Rent rent) {
		this.rent = rent;
	}

	public void setId(Long id) {
		this.id = id;
	}
	public void setStype(Stype stype) {
		this.stype = stype;
	}

	public void setAddress(String address) {
		this.address = address;
	}
	public void setMerchant(Merchant merchant) {
		this.merchant = merchant;
	}
	public void setShopNo(String ShopNo) {
		this.shopNo = ShopNo;
	}
	public void setApplys(List<Apply> applys) {
		this.applys = applys;
	}
	@Override
	public String toString() {
		return "Shop [id=" + id + ", stype=" + stype + ", rent=" + rent + ", address=" + address + ", merchant="
				+ merchant + "]";
	}
}